using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using HadronData;

namespace Hadron
{
    abstract class Projectile
    {
        protected Environment m_environment;
        protected Vector2 m_vecPosition, m_vecVelocity;
        protected float m_fAngle, m_fLifetime;
        protected Circle m_circleBounds;

        public Projectile(Environment p_environment)
        {
            m_environment = p_environment;
            m_vecPosition = Vector2.Zero;
            m_vecVelocity = Vector2.Zero;
            m_circleBounds = new Circle();
        }

        public Vector2 Position
        {
            get { return m_vecPosition; }
            set { m_vecPosition = value; }
        }

        public float Angle
        {
            get { return m_fAngle; }
            set { m_fAngle = value; }
        }

        public Vector2 Velocity
        {
            get { return m_vecVelocity; }
            set { m_vecVelocity = value; }
        }

        public float Lifetime
        {
            get { return m_fLifetime; }
            set { m_fLifetime = value; }
        }

        public Circle BoundingCircle
        {
            get { return m_circleBounds; }
        }

        public abstract Geometry Geometry { get; }

        public virtual void Update(GameTime p_gameTime)
        {
            float fDeltaTime = (float)p_gameTime.ElapsedGameTime.TotalSeconds;
            m_vecPosition += m_vecVelocity * fDeltaTime;
            m_fLifetime -= fDeltaTime;
            m_circleBounds.Centre = m_vecPosition;
        }

        public abstract void Draw(SpriteBatch p_spriteBatch);
   }
}
